Demonstrating Prolog Usage: Building a Simple Game Program

ثبت نشده
چکیده

To demonstrate the use of Prolog and how programming in Prolog is easy and efficient, this paper describe an implementation of the game booby-trap, a game similar to Minesweeper found on most personal computers with windows. Introduction Prolog (Programming in Logic) is a well known programming language in the field of Artificial Intelligence (AI). Although Prolog has much in common with Lisp (List Processing), only Prolog has a built in automated reasoning system or inference engine. Since its invention in 1972 by Alain Colmerauer and his colleagues at the University of AixMarsielle, France, there have been many versions of Prolog. These include Turbo Prolog 1 – now supported by the Prolog Development Center www.pdc.dk), BinProlog 2 (www.binnetcorp.com/ BinProlog), SICStus Prolog (Intelligent Systems Laboratory, 1995 www.sics.se/ sicstus) and LamdaProlog 3. There are also many other popular Prolog’s such as Logic Programming Associates Prolog (LPA www.lpa.co.uk) and AMZI Prolog (www.amzi.com). Dozens of Prolog books and tutorials mention other lesser-known Prologs. Covington 4, one of many who tout Prologs versatility as a programming language, points out how it can implement a variety of algorithms; not just those for which it was specially designed. Prolog consists of two main components: facts and rules. The facts describe relationships between objects whereas the rules define relationships between groups of facts. Prolog is primarily based on three main concepts: pattern matching, automatic backtracking and tree-based data structuring. In the real world, logic-programming languages such as Prolog have not fulfilled their potential when compared to other conventional programming languages 5. This was not due as much to limitations in the language as to the ebb and flow of popular media and general computer hype. According to Somogyi, logicprogramming languages have theoretical advantages over conventional programming languages, however they have not had the same impact on the computer industry. Although this claim may be true in general, in AI research many intelligent and knowledge-based systems have been successfully developed and deployed using Prolog 4. Many of these applications would be much harder to develop in languages other than Prolog. Furthermore, Prolog is an “expressive” programming language, which contrasts with conventional “imperative” languages (see sidebar on imperative languages). Prolog contains a number of advanced features, including high-level declarative programming, automatic dynamic memory allocation and deallocation, built in database functionality, incremental compilation and meta-programming 6. In his book, Luger 7 states that Prolog has made many contributions to AI problem solving with its declarative semantics and built-in unification. Today, Prolog’s have been enhanced with development environments and many integrated tools to simplify implementation. This paper describes the implementation of a simple game program using LPA Win-Prolog. This particular Prolog offers several tools for application development, including a tool for developing Graphical User Interface (GUI), namely the LPA Dialog Editor. This tool lets you draw screens and generate and test the Prolog code insitu. The LPA Dialog Editor is implemented entirely in LPA Win-Prolog using the buit-in predicates described in this article. GUI Development The GUI, an important element in system development, must support an interactive interaction between the system and the user. LPA’s Win-Prolog allows interactive dialog development utilizing a window dialog with GUI elements and control features along with a message handler to interpret the control messages. Win-Prolog offers two class types for developing dialogs: window class and control class. A window class supplies a skeleton framework for developing dialogs. The Window control class provides the means to embed control objects into windows with several control classes such as button, edit, list box, combo box, static, scrollbar and graphics. Using the Dialog Editor plug-in (Figure 1), the user controls objects by click and drag on the scratch window. The Dialog Editor plug-in is a toolkit for easy development of GUIs and it allows easy PCAI 38 17.4 By Wan Hussain Wan Ishak i I

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Exporting Prolog source code

In this paper we present a simple source code configuration tool. ExLibris operates on libraries and can be used to extract from local libraries all code relevant to a particular project. Our approach is not designed to address problems arising in code production lines, but rather, to support the needs of individual or small teams of researchers who wish to communicate their Prolog programs. In...

متن کامل

Reasoning about Termination of Pure Prolog Programs

We provide a theoretical basis for studying termination of (general) logic programs with the Prolog selection rule. To this end we study the class of left terminating programs. These are logic programs that terminate with the Prolog selection rule for all ground goals. We ooer a characterization of left terminating positive programs by means of the notion of an acceptable program that provides ...

متن کامل

طراحی و اجرای یک سرویس Game GIS برای مدیریت بحران زمین‌لرزه مطالعه‌ی موردی: منطقه‌ی 10 تبریز

The term "Game GIS” implies to real spatially enabled games in which a special part of the world is virtually simulated, represented and managed. In fact, game GIS is an integrated system consists of video games and geographical information systems, aimed to simulate and representing spatially enabled environment. The achieved result of implementing a game GIS service can be exploite...

متن کامل

ar X iv : c s . SE / 0 20 70 51 v 2 1 2 Ju l 2 00 2 Exporting Prolog source code

In this paper we present a simple source code configuration tool. ExLibris operates on libraries and can be used to extract from local libraries all code relevant to a particular project. Our approach is not designed to address problems arising in code production lines, but rather, to support the needs of individual or small teams of researchers who wish to communicate their Prolog programs. In...

متن کامل

PROLOG & TXL: A Case Study for Prototyping Structural Testing Supporting Tools

Structured testing criteria are usually used to assess the adequacy of test case sets, defining coverage measures. Control and data flow based criteria employ information about the program graph as well as definition and usage of variables to establish the testing requirements. In this paper, we present an approach to prototype supporting tools for control and data flow based criteria. In the p...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2004